<div class="col-sm-12 col-md-12">

<div class="row">
        <div class="col-sm-12 col-md-12">
            <form class="form-custom clearfix">
                <div class="col-sm-3 col-md-3">
                    <label>需求名称</label>
                    <input class="form-control" type="text" ng-model="params.requName"/>
                </div>
                <div class="col-sm-3 col-md-3">
                    <label>创建时间</label>
                   	<div datetimepicker range start="params.createTime" end="params.createTime_"></div>
                </div>
                <div class="col-sm-3 col-md-3">
                    <label>流程类型</label>
                    <select ng-model="params.requCode" select2 ng-options="item.requCode as item.Name for item in flowTypeList"></select>
                </div>
                <div class="col-sm-3 col-md-3">
                    <label>&nbsp;</label>
                    <button class="btn btn-custom" type="button" ng-click="refresh('first',true)">查询</button>
                    <button class="btn btn-custom" type="button" data-toggle="modal" data-target="#fruitUpload" ng-click="toDetail()" upload-refresh>新增成果</button>
                </div>
            </form>
        </div>
     </div>   

    <table class="table table-striped table-bordered table-condensed index-center  table-costom">
        <thead>
        <tr>
            <th>序号</th>
            <th>需求编号</th>
            <th>流程类型</th>
            <th>需求名称</th>
            <th>成果内容</th>
            <th>创建时间</th>
            <th>确认状态</th>
            <th>发布状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr class="rowlink" ng-repeat="item in limitArr">
                 <td>{{$index+1}}</td>
                 <td>{{item.requCode}}</td>
                 <td>{{item.flowType | DM_flow_type}}</td>
                 <td>{{item.requName}}</td>
                 <td>{{item.fruitCont}}</td>
                 <td>{{item.createTime | date:'yyyy-MM-dd'}}</td>
                 <td>{{item.oprId | DM_fruit_opr_id}}</td>
                 <td>{{item.publicState | DM_public_state}}</td>
            <td>
                <a href="javascript:" data-toggle="modal" data-target="#updateFruit" ng-click="toDetail(copy(item))" ng-if="!(item.oprId=='1') && item.publicState =='0'" upload-refresh="true">修改</a>
                <a href="javascript:"  data-toggle="modal" data-target="#removeDialog" ng-click="toDelete(copy(item))" ng-if="!(item.oprId=='1') && item.publicState =='0'">删除</a>
                <a href="javascript:"  data-toggle="modal" ng-click="publishIt(copy(item))" ng-if="item.oprId=='0' && item.publicState =='0'">发布</a>
            </td>
        </tr>
        </tbody>
    </table>
            <div   data-remote-paging="pager" 
					data-refresh="refresh" 
					data-current="current" 
					data-total="total" 
					data-data="limitArr"
					data-limit="limit"
					data-params="params"
			></div>
</div>

<!-- 新增成果对话框 -->
<div class="modal fade" id="fruitUpload" tabindex="-1" role="dialog" aria-hidden="true">
<form class="form-horizontal" name="QR" novalidate="novalidate" auto-file-upload ng-submit="create(processes)">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4  class="modal-title">上传成果</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12 col-md-12">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">需求名称</label>

                                <div class="col-lg-9">
                                	<div class="input-group">
					            		<input type="text" placeholder="需求名称"  ng-model="processes.demand.requName" class="form-control" readonly="readonly" required>
									 	<div class="input-group-btn">   
			          				  		<button type="button" class="btn btn-default" data-toggle="modal" data-target="#select" ng-click="searchData_()">选择</button>
			       					 	</div>
                               		 </div>
                                </div>
                                <span style="color: red;">*</span>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">成果内容</label>

                                <div class="col-lg-9">
                                    <input type="text" placeholder="成果内容" class="form-control" ng-model="processes.fruitCont"
                                    	maxlength='50'
					                	required 
					                    valid-tip="{required:'成果内容非空'}"
					                    valid-pos="bottom"
                                    >
                                </div>
                                <span style="color: red;">*</span>
                            </div>
						    <div class="form-group">
						        <label class="col-lg-2 control-label">成果文档</label>
						        <div class="col-lg-9">
				 					<div uploader 
				 						multiple
				 						ng-model="processes.fileResponseList" 
				 						name="manyFiles" 
				 						server="upload.shtml" 
				 						files="files" 
				 						extensions="doc,docx,xls,xlsx,ppt,pptx,csv,txt"
				 						file-queued-error="fn($file,$type,$ext)"
				 					></div>
						        </div>
						    </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary" ng-disabled="QR.$invalid">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    </form>
    <!-- /.modal-dialog -->
</div>

<!-- 修改 成果对话框 -->
<div class="modal fade" id="updateFruit" tabindex="-1" role="dialog" aria-hidden="true">
<form class="form-horizontal" name="QR" novalidate="novalidate" auto-file-upload ng-submit="modify(processes)">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">修改成果</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12 col-md-12">
                        <form role="form" class="form-horizontal" novalidate="novalidate">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">需求名称</label>

                                <div class="col-lg-9">
                                	<div class="input-group">
					            		<input type="text" placeholder="需求名称"  ng-model="processes.demand.requName" class="form-control" readonly="readonly">
									 	<div class="input-group-btn">   
			          				  		<button type="button" class="btn btn-default" data-toggle="modal" data-target="#select" ng-click="searchData_()">选择</button>
			       					 	</div>
			       					 </div>
                                </div>
                                <span style="color: red;">*</span>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">成果内容</label>

                                <div class="col-lg-9">
                                    <input type="text" placeholder="成果内容" class="form-control" ng-model="processes.fruitCont"
                                    	maxlength='50'
					                	required 
					                    valid-tip="{required:'成果内容非空'}"
					                    valid-pos="bottom"
                                    >
                                </div>
                                <span style="color: red;">*</span>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">成果附件列表</label>
                                <div class="col-lg-9">
                                	<ul>
                                		<li ng-repeat="item in fileList">
                                			<a href="javascript:" ng-click="download(item)">{{item.fileName}}</a>
                                			<a href="javascript:" data-toggle="modal" data-target="#removeAnnex" ng-click="toDeleteAnnex(item.fileId, processes)" >删除</a>
                                		</li>
                                	</ul>
                                </div>
                            </div>
						    <div class="form-group" ng-if="!(processes.oprId==1)">
						        <label class="col-lg-2 control-label" >成果文档</label>
						        <div class="col-lg-9">
				 					<div uploader 
				 						multiple
				 						ng-model="processes.fileResponseList" 
				 						name="manyFiles" 
				 						server="upload.shtml" 
				 						files="files" 
				 						extensions="doc,docx,xls,xlsx,ppt,pptx,csv,txt"
				 						file-queued-error="fn($file,$type,$ext)"
				 					></div>
						        </div>
						    </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">修改</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
    </form>
</div>

<!-- 删除附件对话框 -->
<div class="modal fade" id="removeAnnex" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">删除附件</h4>
            </div>
            <div class="modal-body">
                确认要删除此附件么？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="delAttach()">确认删除</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- 删除对话框 -->
<div class="modal fade" id="removeDialog" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">删除数据</h4>
            </div>
            <div class="modal-body">
                确认要删除此数据么？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="remove(processes)">确认删除</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- 选择对话框 -->
<div class="modal fade" id="select" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">请选择</h4>
            </div>
            <div class="modal-body">
                <div class="row" ><!-- 用来查询项目申请单位的条件 -->
                    <div class="col-sm-4 col-md-4">
                    	<label>需求名称 </label>
                    	<input type="text" class="form-control" ng-model="searchParams.requName"/>
                    </div>
                    <div class="col-sm-4 col-md-4">
                    	<label>&nbsp;</label>
                    	<button class="btn btn-info" ng-click="searchData(searchParams)">查询</button>
                    	<label>&nbsp;</label>
                    </div>
                </div>
                
                <table class="table table-striped table-bordered table-condensed index-center  table-costom">
	                <thead>
		                <tr>
		                    <th>序号</th>
		                    <th>需求编号</th>
		                    <th>需求名称</th>
		                    <th>操作</th>
		                </tr>
	                </thead>
                	<tbody>
	                	<tr class="rowlink" ng-repeat="item in searchList">
	                		<td>{{$index + 1}}</td>
	                		<td>{{item.requCode}}</td>
	                		<td>{{item.requName}}</td>
	                		<td><a href="javascript:" data-dismiss="modal" ng-click="selected(item)">选择</a></td>
	                	</tr>
                	</tbody>
                </table>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div><!-- /.modal -->
<a id="downlink" target="_blank"></a>
<div ng-include="'templates/technologicalProcess/steps-extends.html'"></div>
<div ng-include="'templates/technologicalProcess/details-extends.html'"></div>